Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

turf-meta

Package Overview
Dependencies
Maintainers
7
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

turf-meta

meta and functional programming helpers for turf modules

  • 3.0.12
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
decreased by-43.77%
Maintainers
7
Weekly downloads
 
Created
Source

turf-meta

coordEach

Iterate over coordinates in any GeoJSON object, similar to Array.forEach.

Parameters

  • layer Object any GeoJSON object
  • callback Function a method that takes (value)
  • excludeWrapCoord [boolean] whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.

Examples

var point = { type: 'Point', coordinates: [0, 0] };
coordEach(point, function(coords) {
  // coords is equal to [0, 0]
});

coordReduce

Reduce coordinates in any GeoJSON object into a single value, similar to how Array.reduce works. However, in this case we lazily run the reduction, so an array of all coordinates is unnecessary.

Parameters

  • layer Object any GeoJSON object
  • callback Function a method that takes (memo, value) and returns a new memo
  • memo Any the starting value of memo: can be any type.
  • excludeWrapCoord [boolean] whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration.

Returns Any combined value

propEach

Iterate over property objects in any GeoJSON object, similar to Array.forEach.

Parameters

  • layer Object any GeoJSON object
  • callback Function a method that takes (value)

Examples

var point = { type: 'Feature', geometry: null, properties: { foo: 1 } };
propEach(point, function(props) {
  // props is equal to { foo: 1}
});

propReduce

Reduce properties in any GeoJSON object into a single value, similar to how Array.reduce works. However, in this case we lazily run the reduction, so an array of all properties is unnecessary.

Parameters

  • layer Object any GeoJSON object
  • callback Function a method that takes (memo, coord) and returns a new memo
  • memo Any the starting value of memo: can be any type.

Returns Any combined value

featureEach

Iterate over features in any GeoJSON object, similar to Array.forEach.

Parameters

  • layer Object any GeoJSON object
  • callback Function a method that takes (value)

Examples

var feature = { type: 'Feature', geometry: null, properties: {} };
featureEach(feature, function(feature) {
  // feature == feature
});

coordAll

Get all coordinates from any GeoJSON object, returning an array of coordinate arrays.

Parameters

  • layer Object any GeoJSON object

Returns Array<Array<Number>> coordinate position array


This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.

Installation

Install this module individually:

$ npm install turf-meta

Or install the Turf module that includes it as a function:

$ npm install turf

Keywords

FAQs

Package last updated on 05 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc